Bug 590959 - Set child_has_focus flag properly
authorBenjamin Otte <otte@gnome.org>
Thu, 6 Aug 2009 14:25:20 +0000 (16:25 +0200)
committerBenjamin Otte <otte@gnome.org>
Thu, 6 Aug 2009 14:39:19 +0000 (16:39 +0200)
Previously, this flag wasn't cleared properly when the notebook lost
focus, but only when the notebook was focussed again later.
As this flag is only used to advance correctly focus pages by grabbing
focus to the new page after switching the page, this is not good.
In particular, it can cause a focus grab when programmatically switching
the notebook page and the focus is inside a completely different widget.

gtk/gtknotebook.c

index aa1a5ade06884a4616ad88261882b06ed8440003..a349add78677fd4c1db6221cd5cfb4d777226ebb 100644 (file)
@@ -3094,8 +3094,6 @@ static gint
 gtk_notebook_focus_in (GtkWidget     *widget,
                       GdkEventFocus *event)
 {
-  GTK_NOTEBOOK (widget)->child_has_focus = FALSE;
-
   gtk_notebook_redraw_tabs (GTK_NOTEBOOK (widget));
   
   return FALSE;
@@ -3978,6 +3976,8 @@ gtk_notebook_set_focus_child (GtkContainer *container,
            }
        }
     }
+  else
+    notebook->child_has_focus = FALSE;
 
   GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->set_focus_child (container, child);
 }